package com.awan.adapter;

import android.app.Activity;
import android.content.Context;
//import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.beem.project.beem.R;

public class LiveTVMenuAdapter extends BaseAdapter{
	
	public static String[] tvTitleMenu = {/*"MNC RCTI", "MNC Global TV", "MNCTV", "MNC Sindo TV", */"Trans 7", "Trans TV"};
	public static String[] tvStreamUrl = {
		/*"http://linktone.co.id/api/session/?act=streamapp&chn=4101",
		"http://linktone.co.id/api/session/?act=streamapp&chn=4102",
		"http://linktone.co.id/api/session/?act=streamapp&chn=4103",
		"http://linktone.co.id/api/session/?act=streamapp&chn=4104",*/
		"rtsp://live.mytrans.com/live/trans7@5.sdp",
		"rtsp://live.mytrans.com/live/transtv@5.sdp"
	};

	Activity mActivity;
	Context mContext;
    private LayoutInflater mInflater;
    public LiveTVMenuAdapter(Activity act, Context c)
    {
    	   mActivity=act;
           mContext=c;
           mInflater = LayoutInflater.from(c);
    }
    public int getCount()
    {
    	
           return tvTitleMenu.length;
    }
    public Object getItem(int position)
    {
           return position;
    }
    public long getItemId(int position)
    {
           return position;
    }
    public View getView(int position, View convertView, ViewGroup parent)
    {
    	
           ViewHolder holder=null;
           if(convertView==null){
        	   holder = new ViewHolder();
           }else{
        	   	holder=null;
        	   	holder = new ViewHolder();    
           }
           
           convertView = mInflater.inflate(R.layout.streaming_rowmenu, parent,false); 
		   holder.txtMenu=(TextView)convertView.findViewById(R.id.streammenutext);
		   holder.iconThumbMenu=(ImageView)convertView.findViewById(R.id.streammenuicon);
       
         holder.txtMenu.setText(tvTitleMenu[position]);
         holder.iconThumbMenu.setImageResource(getIconMenu(position));
          
           return convertView;
    }
    static class ViewHolder
    {        
    	ImageView iconThumbMenu;
        TextView txtMenu;        
    }
    static int getIconMenu(int pos){
    	int returnInt = R.drawable.beem_launcher_icon_silver;
    	switch(pos){
    	case 0:
    		returnInt = R.drawable.stream_rcti;
    		break;
    	case 1:
    		returnInt = R.drawable.stream_gtv;
    		break;
    	case 2:
    		returnInt = R.drawable.stream_mnctv;
    		break;
    	case 3:
    		returnInt = R.drawable.stream_sindotv;
    		break;
    	case 4:
    		returnInt = R.drawable.stream_transtujuh;
    		break;	
    	case 5:
    		returnInt = R.drawable.stream_transtv;
    		break;
    	}
    	return returnInt;
    }

}
